<template>
	<div>
		<div class="contentBox mt30">
			其他资金变动：
			<span>
				{{ aomunt(otherNetAmount) }}
			</span>
		</div>
		<el-table
			v-loading="loading"
			element-loading-spinner="el-icon-loading"
			size="mini"
			class="small-size-table"
			:data="[data]"
			style="width: 100%; margin: 15px 0"
			:header-cell-style="getRowClass"
			highlight-current-row
		>
			<el-table-column
				prop="parentCashUpAmount"
				align="center"
				label="上级给会员充值"
			>
				<template slot="header" slot-scope="{ column, $index }">
					<span>
						上级给会员充值
						<el-tooltip
							class="item"
							effect="dark"
							content="统计当期被上级现金充值上分的总额"
							placement="top-start"
						>
							<i class="el-icon-question"></i>
						</el-tooltip>
					</span>
				</template>
				<template slot-scope="scope">
					<FormItem :scope="scope" :updateData="updateData" />
				</template>
			</el-table-column>
			<el-table-column
				prop="parentCashDownAmount"
				align="center"
				label="上级给会员提现"
			>
				<template slot="header" slot-scope="{ column, $index }">
					<span>
						上级给会员提现
						<el-tooltip
							class="item"
							effect="dark"
							content="统计当期被上级现金提现下分的总额"
							placement="top-start"
						>
							<i class="el-icon-question"></i>
						</el-tooltip>
					</span>
				</template>
				<template slot-scope="scope">
					<FormItem :scope="scope" :updateData="updateData" />
				</template>
			</el-table-column>
			<el-table-column
				prop="parentCreditRepaymentAmount"
				align="center"
				label="上级帮会员还款"
			>
				<template slot="header" slot-scope="{ column, $index }">
					<span>
						上级帮会员还款
						<el-tooltip
							class="item"
							effect="dark"
							content="统计当期被上级现金或信用还款的总额"
							placement="top-start"
						>
							<i class="el-icon-question"></i>
						</el-tooltip>
					</span>
				</template>
				<template slot-scope="scope">
					<FormItem :scope="scope" :updateData="updateData" />
				</template>
			</el-table-column>
			<el-table-column
				prop="otherAdjustmentTotalAmount"
				align="center"
				label="其他资金变动总计"
			>
				<template slot="header" slot-scope="{ column, $index }">
					<span>
						其他资金变动总计
						<el-tooltip
							class="item"
							effect="dark"
							placement="top-start"
						>
							<div slot="content">
								汇总上级给会员的充值、提现、还款的总额;
								公式：上级给会员充值+上级给会员提现+上级帮会员还款
							</div>
							<i class="el-icon-question"></i>
						</el-tooltip>
					</span>
				</template>
				<template slot-scope="scope">
					<span>
						{{ aomunt(otherNetAmount) }}
					</span>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
import FormItem from './formItem.vue'
import mixin from './mixin.js'
import list from '@/mixins/list'
export default {
  components: {
    FormItem
  },
  mixins: [list, mixin],
  props: {
    data: {
      type: Object,
      default: {}
    }
  },
  data() {
    return {
    }
  },
  computed: {
    // 其他资金变动总计
    // 汇总上级给会员的充值、提现、还款的总额; 公式：上级给会员充值+上级给会员提现+上级帮会员还款
    otherNetAmount() {
      const { parentCashUpAmount,
        parentCashDownAmount,
        parentCreditRepaymentAmount
      } = this.data
      return this.calculateTotal([
        parentCashUpAmount,
        parentCashDownAmount,
        parentCreditRepaymentAmount
      ])
    }
  },
  watch: {
    otherNetAmount(val) {
      this.updateData(val, 'otherNetAmount')
    }
  },
  mounted() {
    this.$emit('update:data', {
      ...this.data,
      ...{
        otherNetAmount: this.otherNetAmount
      }
    })
  }
}
</script>
<style scoped>
.contentBox {
	text-align: center;
	font-size: 18px;
	font-weight: bold;
}
</style>
